﻿Imports QLTHUVIEN.DTO
Public Class ChucVuDAO
    Public Function LayDanhSach() As DataTable
        Dim strSql As String = "SELECT MaChucVu, TenChucVu FROM ChucVu WHERE isDelete = 'False'"
        Dim dt As DataTable = DataProvider.ExecuteQuery(strSql)
        Return dt
    End Function

    Public Sub ThemChucVu(ByVal ChucVu As ChucVuDTO)
        Dim strSql As String = "INSERT INTO CHUCVU(TenChucVu) VALUES(N'" & ChucVu.TenChucVu & "')"
        DataProvider.ExecuteQuery(strSql)
    End Sub

    Public Sub SuaChucVu(ByVal ChucVu As ChucVuDTO)
        Dim strSql As String = "UPDATE CHUCVU SET TenChucVu =N'" & ChucVu.TenChucVu & "' WHERE MaChucVu = " & ChucVu.MaChucVu
        DataProvider.ExecuteQuery(strSql)
    End Sub

    Public Sub XoaChucVu(ByVal ChucVu As ChucVuDTO)
        Dim strSql As String = "UPDATE CHUCVU SET isDelete ='" & ChucVu.IsDelete.ToString() & "' WHERE MaChucVu = " & ChucVu.MaChucVu
        DataProvider.ExecuteQuery(strSql)
    End Sub
End Class
